<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath =
            request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                    + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8" name="viewport" content="initial-scale=1.0, user-scalable=no">
    <title>后台管理</title>
    <link rel="shortcut icon" href="static/image/logo01.ico"/>
    <link href="static/easyui/themes/default/easyui.css" rel="stylesheet"/>
    <link href="static/easyui/themes/icon.css" rel="stylesheet"/>
    <script type="text/javascript" src="static/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="static/easyui-lang-zh_CN.js"></script>
</head>
<body class="easyui-layout">
<%
    String username = String.valueOf(session.getAttribute("username"));
    username = "admin";
%>
<!-- 顶部菜单栏 -->
<div data-options="region:'north',border:true, collapsible:false" style="height: 100px;">
    后台管理系统
    <a href="javascript:void(0)" id="mb" class="easyui-menubutton"
       data-options="menu:'#mm',iconCls:'icon-more'"><%=username %>
    </a>
    <div id="mm" style="width:150px;">
        <div data-options="iconCls:'icon-man'">个人信息</div>
        <div data-options="iconCls:'icon-edit'" onclick="addTab('修改密码', 'manage/editPassword.jsp')">
            修改密码
        </div>
        <div data-options="iconCls:'icon-back'" onclick='exit()'>退出登录</div>
    </div>
</div>
<!-- 左侧菜单栏 -->
<div data-options="region:'west',title:'菜单栏',split:true" style="width: 200px;">
    <div id="sm" style="width:200px"></div>
</div>
<!-- 中间主面板 -->
<div data-options="region:'center'">
    <!-- 选项板 -->
    <div id="tabsPanel" class="easyui-tabs" style="width: 100%; height: 100%;">
        <div title="失物信息" style="padding: 20px; display: none;">
            <iframe class="page-iframe" src="manage/queryLost.jsp" frameborder="no" border="no"
                    height="100%" width="100%" scrolling="auto"></iframe>
        </div>
    </div>
</div>
<!-- 弹出窗 -->
<div id="topWindow"></div>
<script type="text/javascript">
  var data = [{
    text: '失物招领',
    iconCls: 'icon-help',
    state: 'close',
    children: [
      {
        text: '查询',
        title: '失物招领列表',
        url: "manage/queryLost.jsp"
      },
      {
        text: '新增',
        title: '新增失物招领',
        url: "manage/addLost.jsp"
      }
    ]
  }, {
    text: '寻物启事',
    iconCls: 'icon-search',
    children: [
        {
      text: '查询',
      title: '寻物启事列表',
      url: "manage/queryFind.jsp"
    },{
        text: '新增',
        title: '新增寻物启事',
        url: "manage/addFind.jsp"
      }]
  },
    {
      text: "用户管理",
      iconCls: "icon-man",
      children: [
        {
          text: '用户列表',
          title: "用户列表",
          url: "manage/admin/showUser.jsp"
        }
      ]
    },{
    text: "公告",
      iconCls: "icon-help",
      children: [
        {
          text: "发布",
          title: "发布公告",
          url: "manage/addNotice.jsp"
        },{
          text: "查询",
          title: "查询公告",
          url: "manage/queryNotice.jsp"
        }
      ]
    }
  ];
  $(function () {
    $('#sm').sidemenu({
      data: data,
      onSelect: function (item) {
        addTab(item.title, item.url);
      }
    });
  })

  // 新增面板
  function addTab(title, url) {
    /* 功能是第一次点击打开tab页就打开一个tab页，当没关闭这个tab页，又去另外一个tab页操作，再回来刚才的tab页后就不用打开另外一个和刚才一样的tab页，而是同一个tab页。 */
    if ($('#tabsPanel').tabs('exists', title)) {
      $('#tabsPanel').tabs('select', title);
    } else {
      var content = '<iframe scrolling="auto" frameborder="0"  src="' + url
          + '" style="width:100%;height:100%;"></iframe>';
      $('#tabsPanel').tabs('add', {
        title: title,
        content: content,
        closable: true
      });
    }
  }

  function exit() {
    $.messager.confirm("EXIT", "确认退出？", function (r) {
      if (r) {
        window.location.href = 'login.jsp';
      } else {

      }
    })
  }
</script>
</body>
</html>